import base64
import json

import requests


class ApiRequests:
    def send(self, data: dict):
        res = requests.request(method=data["method"], url=data["url"], headers=data["headers"])
        if data["encoding"] == "base64":
            return json.loads(base64.b64decode(res.content))
        else:
            return None
